package com.simsuni.core;

import java.util.ArrayList;
import java.util.List;

import com.jake.rcp.gef.model.GefModel;
import com.simsuni.core.ext.SimProcessible;


public class SimModel extends SimEntity implements SimProcessible{
	
	private List<SimServiceEntity> serviceEntities = new ArrayList<SimServiceEntity>();

	private SimProcess process;
	
	public SimModel(){
		super();
	}
	public SimModel(String name) {
		super(name);
	}
	public List<SimServiceEntity> getServiceEntities() {
		return serviceEntities;
	}
	public void removeActiveEntity(String entityName){
		for(SimServiceEntity entity : serviceEntities){
			if(entity.getName().equals(entityName)){
				serviceEntities.remove(entity);
				break;
			}
		}
	}
	public void addEntity(SimEntity entity){
		super.addEntity(entity);
		if(entity instanceof SimServiceEntity){
			serviceEntities.add((SimServiceEntity)entity);
		}
	}
	public void loadProcess(){
	}
	@Override
	public SimProcessible getNextStep() {
		return null;
	}
	public void setProcess(SimProcess process){
		this.process = process;
		
		for(GefModel entity : getChildren()){
			if(entity instanceof SimEntity){
				process.addEntity((SimEntity)entity);
			}
		}
		
	}
}
